Fix DispatcherQueueTimerExtensions example #688
+1
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What changes to the docs does this PR provide?
This PR fixes the example documentation for DispatcherQueueTimerExtensions, which incorrectly attempts to demonstrate creating a DispatcherQueueTimer with
new DispatcherQueueTimer()
.DispatcherQueueTimer does not have such a public constructor.
The fix rewrites the example to create a DispatcherQueueTimer following https://github.com/MicrosoftDocs/winapps-winrt-api/blob/4a912fdbae00a0594556d2a3fbb9f721469b4bfe/microsoft.ui.dispatching/dispatcherqueuetimer.md#-examples.Revised, the below option is more concise.The fix rewrites the example to create a DispatcherQueueTimer following the docs for Microsoft.Toolkit.Uwp.UI.DispatcherQueueTimerExtensions, which are also correct in the case of WinUI 3:
WindowsCommunityToolkitDocs/dotnet/xml/Microsoft.Toolkit.Uwp.UI/DispatcherQueueTimerExtensions.xml
Line 58 in 58c55b6
(The only notable difference is that while in UWP the class used is Windows.System.DispatcherQueueTimer and in WinUI 3 the class used is Microsoft.UI.Dispatching.DispatcherQueueTimer, the timer creation process is the same for both.)
PR Checklist
Please check if your PR fulfills the following requirements:
dev
for new features,main
for typos/improvements)Other information